7
7
8
8
import actstream
9
9
import actstream .actions
10
+ import waffle
10
11
from django .conf import settings
11
12
from django .contrib .auth .models import User
12
13
from django .contrib .contenttypes .fields import GenericForeignKey , GenericRelation
@@ -190,6 +191,7 @@ def clear_cached_contributors(self):
190
191
191
192
def save (self , update = False , * args , ** kwargs ):
192
193
"""Override save method to take care of updated if requested."""
194
+
193
195
new = not self .id
194
196
195
197
if not new :
@@ -203,8 +205,21 @@ def save(self, update=False, *args, **kwargs):
203
205
# actstream
204
206
# Authors should automatically follow their own questions.
205
207
actstream .actions .follow (self .creator , self , send_action = False , actor_only = False )
206
- # Either automatically classify the question or add it to the moderation queue
207
- question_classifier .delay (self .id )
208
+ if waffle .switch_is_active ("flagit-spam-autoflag" ):
209
+ from kitsune .questions .utils import flag_question
210
+ from kitsune .users .models import Profile
211
+
212
+ flag_question (
213
+ self ,
214
+ by_user = Profile .get_sumo_bot (),
215
+ notes = (
216
+ "Automatically flagged for topic moderation:"
217
+ " flagit-spam-autoflag is active"
218
+ ),
219
+ )
220
+ else :
221
+ # Either automatically classify the question or add it to the moderation queue
222
+ question_classifier .delay (self .id )
208
223
209
224
def add_metadata (self , ** kwargs ):
210
225
"""Add (save to db) the passed in metadata.
0 commit comments